package chapter06

/**
 * Created with IntelliJ IDEA.
 * ClassName: Test10_AnnoymousClass
 * Package: chapter06
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 *          Date: 2023-06-22
 *          Time: 20:25
 */

//匿名子类
object Test10_AnnClass {
  def main(args: Array[String]): Unit = {
    //直接new 创建了匿名的子类
    val person:Person10 = new Person10 {
      override var name: String = "alice"

      override def ext(): Unit = println("person eat")
    }

    println(person.name)
    person.ext()
  }
}


abstract class Person10{
  var name:String
  def ext():Unit
}